package cn.iocoder.yudao.module.patent.dal.mysql.authors;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.patent.dal.dataobject.authors.AuthorsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.patent.controller.admin.authors.vo.*;

/**
 * 专利作者信息 Mapper
 *
 * @author admin
 */
@Mapper
public interface AuthorsMapper extends BaseMapperX<AuthorsDO> {

    default PageResult<AuthorsDO> selectPage(AuthorsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AuthorsDO>()
                .eqIfPresent(AuthorsDO::getPatentId, reqVO.getPatentId())
                .eqIfPresent(AuthorsDO::getSignatureOrder, reqVO.getSignatureOrder())
                .eqIfPresent(AuthorsDO::getAuthorType, reqVO.getAuthorType())
                .likeIfPresent(AuthorsDO::getAuthorName, reqVO.getAuthorName())
                .eqIfPresent(AuthorsDO::getGender, reqVO.getGender())
                .eqIfPresent(AuthorsDO::getEducation, reqVO.getEducation())
                .eqIfPresent(AuthorsDO::getProfessionalTitle, reqVO.getProfessionalTitle())
                .eqIfPresent(AuthorsDO::getWorkingUnit, reqVO.getWorkingUnit())
                .eqIfPresent(AuthorsDO::getContributionRate, reqVO.getContributionRate())
                .orderByDesc(AuthorsDO::getId));
    }

}